﻿<UserControl x:Class="Quizio.Views.HomeViews.ResultView.SplitResult"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="700">
    
    <Grid Style="{StaticResource ContentRoot}">
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="100"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="6"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <ScrollViewer Margin="{StaticResource SplitLeft}">
            <StackPanel MinWidth="200" MaxWidth="300">
                <TextBlock HorizontalAlignment="Left" Style="{StaticResource Heading2}">
                    <Run Text="{Binding ResultDataAggregator.Challenge.ChallengeGame.Player.Name, Mode=OneWay}"></Run>
                </TextBlock>
                <TextBlock Text="Benötigte Zeit: " Style="{StaticResource Heading2}" HorizontalAlignment="Right">
                    <Run Text="{Binding ResultDataAggregator.Challenge.ChallengeGame.Time, Mode=OneWay}"></Run>
                    <Run Text="Sekunden"></Run>
                </TextBlock>
                <TextBlock Text="Richtig Beantwortete Fragen: " Style="{StaticResource Heading2}" Margin="0,10">
                    <Run Text="{Binding CorrectChallengerInputs.Count, Mode=OneWay}"></Run>
                </TextBlock>
                <TextBlock Text="Falsch Beantwortete Fragen: " Style="{StaticResource Heading2}">
                    <Run Text="{Binding FalseChallengerInputs.Count, Mode=OneWay}"></Run>
                </TextBlock>
                <ScrollViewer MaxHeight="200">
                    <ItemsControl x:Name="wrong_left" ItemsSource="{Binding FalseChallengerInputs}" VerticalAlignment="Bottom" HorizontalAlignment="Left" MinWidth="200" MaxWidth="300">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid Margin="0,10" MinWidth="200" MaxWidth="300">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock MaxWidth="200"  Grid.Column="0" Grid.Row="0" TextWrapping="Wrap" HorizontalAlignment="Left">
                                        <Run Text="Frage: "></Run>
                                        <Run Text="{Binding Question.QuestionString}"></Run>
                                    </TextBlock>
                                    <TextBlock Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left">
                                        <Run Text="Korrekte Antwort: "></Run>
                                        <Run FontWeight="Bold" Text="{Binding CorrectAnswer.AnswerText}"></Run>
                                    </TextBlock>
                                    <TextBlock Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left">
                                        <Run Text="Antwort von"></Run>
                                        <Run Text="{Binding ElementName=wrong_left, Path=DataContext.ResultDataAggregator.Challenge.ChallengeGame.Player.Name}"></Run>
                                        <Run Text=":  "></Run>
                                        <Run FontWeight="Bold" Text="{Binding GivenAnswer.AnswerText}"></Run>
                                    </TextBlock>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </ScrollViewer>
                <TextBlock Text="Timeouts: " Style="{StaticResource Heading2}" Margin="0,10">
                    <Run Text="{Binding TimedOutChallengerInputs.Count, Mode=OneWay}"></Run>
                </TextBlock>
                <ScrollViewer MaxHeight="100">
                    <ItemsControl x:Name="timeout_left" ItemsSource="{Binding TimedOutChallengerInputs}" VerticalAlignment="Top" HorizontalAlignment="Left" MinWidth="200" MaxWidth="300">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid Margin="0,10" MinWidth="200" MaxWidth="300">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock MaxWidth="200" Grid.Column="0" Grid.Row="0" TextWrapping="Wrap" HorizontalAlignment="Left">
                                        <Run Text="Frage: "></Run>
                                        <Run Text="{Binding Question.QuestionString}"></Run>
                                    </TextBlock>
                                    <TextBlock Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left">
                                        <Run Text="Korrekte Antwort: "></Run>
                                        <Run FontWeight="Bold" Text="{Binding CorrectAnswer.AnswerText}"></Run>
                                    </TextBlock>
                                    <TextBlock TextWrapping="Wrap" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left">
                                        <Run Text="{Binding ElementName=timeout_left, Path=DataContext.ResultDataAggregator.Challenge.ChallengeGame.Player.Name}"></Run>
                                        <Run Text="hat zu lange gebraucht: "></Run>
                                        <Run FontWeight="Bold" Text="{Binding GivenAnswer.AnswerText}"></Run>
                                    </TextBlock>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </ScrollViewer>
            </StackPanel>
        </ScrollViewer>
        <GridSplitter Grid.Column="1" />
        <ScrollViewer Grid.Column="2 " Margin="{StaticResource SplitRight}">
            <StackPanel MinWidth="200" MaxWidth="300">
                <TextBlock HorizontalAlignment="Left" Style="{StaticResource Heading2}">
                    <Run Text="{Binding ResultDataAggregator.Challenge.ResponseGame.Player.Name, Mode=OneWay}"></Run>
                </TextBlock>
                <TextBlock Text="Benötigte Zeit: " Style="{StaticResource Heading2}" HorizontalAlignment="Right">
                    <Run Text="{Binding ResultDataAggregator.Challenge.ResponseGame.Time, Mode=OneWay}"></Run>
                    <Run Text="Sekunden"></Run>
                </TextBlock>
                <TextBlock Text="Richtig Beantwortete Fragen: " Style="{StaticResource Heading2}" Margin="0,10">
                    <Run Text="{Binding CorrectResponsePlayerInputs.Count, Mode=OneWay}"></Run>
                </TextBlock>
                <TextBlock Text="Falsch Beantwortete Fragen: " Style="{StaticResource Heading2}">
                    <Run Text="{Binding FalseResponsePlayerInputs.Count, Mode=OneWay}"></Run>
                </TextBlock>
                <ScrollViewer MaxHeight="200">
                    <ItemsControl x:Name="wrong_right" ItemsSource="{Binding FalseResponsePlayerInputs}" VerticalAlignment="Bottom" HorizontalAlignment="Left" MinWidth="200" MaxWidth="300">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid Margin="0,10" MinWidth="200" MaxWidth="300">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock MaxWidth="200" Grid.Column="0" Grid.Row="0" TextWrapping="Wrap" HorizontalAlignment="Left">
                                        <Run Text="Frage: "></Run>
                                        <Run Text="{Binding Question.QuestionString}"></Run>
                                    </TextBlock>
                                    <TextBlock Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" TextWrapping="Wrap">
                                        <Run Text="Korrekte Antwort: "></Run>
                                        <Run FontWeight="Bold" Text="{Binding CorrectAnswer.AnswerText}"></Run>
                                    </TextBlock>
                                    <TextBlock Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" TextWrapping="Wrap">
                                        <Run Text="Antwort von"></Run>
                                        <Run Text="{Binding ElementName=wrong_right, Path=DataContext.ResultDataAggregator.Challenge.ResponseGame.Player.Name}"></Run>
                                        <Run Text=":  "></Run>
                                        <Run FontWeight="Bold" Text="{Binding GivenAnswer.AnswerText}"></Run>
                                    </TextBlock>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </ScrollViewer>
                <TextBlock Text="Timeouts: " Style="{StaticResource Heading2}" Margin="0,10">
                    <Run Text="{Binding TimedOutResponsePlayerInputs.Count, Mode=OneWay}"></Run>
                </TextBlock>
                <ScrollViewer MaxHeight="100">
                    <ItemsControl x:Name="timeout_right" ItemsSource="{Binding TimedOutResponsePlayerInputs}" VerticalAlignment="Top" HorizontalAlignment="Left" MinWidth="200" MaxWidth="300">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid Margin="0,10" MinWidth="200" MaxWidth="300">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock MaxWidth="200" Grid.Column="0" Grid.Row="0" TextWrapping="Wrap" HorizontalAlignment="Left">
                                        <Run Text="Frage: "></Run>
                                        <Run Text="{Binding Question.QuestionString}"></Run>
                                    </TextBlock>
                                    <TextBlock Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left">
                                        <Run Text="Korrekte Antwort: "></Run>
                                        <Run FontWeight="Bold" Text="{Binding CorrectAnswer.AnswerText}"></Run>
                                    </TextBlock>
                                    <TextBlock TextWrapping="Wrap" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left">
                                        <Run Text="{Binding ElementName=timeout_right, Path=DataContext.ResultDataAggregator.Challenge.ResponseGame.Player.Name}"></Run>
                                        <Run Text="hat zu lange gebraucht:"></Run>
                                        <Run FontWeight="Bold" Text="{Binding GivenAnswer.AnswerText}"></Run>
                                    </TextBlock>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </ScrollViewer>
            </StackPanel>
        </ScrollViewer>
        <mui:ModernProgressRing Grid.Column="2" Grid.Row="1" Width="50" Height="50" IsEnabled="True" IsActive="{Binding ShowOrHide}" VerticalAlignment="Bottom" HorizontalAlignment="Left">
        </mui:ModernProgressRing>
        <mui:ModernButton Grid.Column="2" Grid.Row="1" Content="Schliessen" Command="{Binding CloseWindow}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
                          EllipseDiameter="40" EllipseStrokeThickness="2" IconWidth="20" IconHeight="20" HorizontalAlignment="Right" VerticalAlignment="Bottom"
                          Margin="0,10,0,0"
                          IconData="F1 M 26.9166,22.1667L 37.9999,33.25L 49.0832,22.1668L 53.8332,26.9168L 42.7499,38L 53.8332,49.0834L 49.0833,53.8334L 37.9999,42.75L 26.9166,53.8334L 22.1666,49.0833L 33.25,38L 22.1667,26.9167L 26.9166,22.1667 Z ">
        </mui:ModernButton>
    </Grid>
</UserControl>
